<style>
    table tr th{
        text-align: center;
    }
    .rule-fields, .rule-steps {
        width: 220px!important;
    }
    .sp_container{
        width: 100%!important;
    }
    .nav-tabs-custom{
        margin-right: 15px;
        margin-left: 15px;
    }
</style>
<div class="row main-content">
    <form id="rule-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
        <div class="nav-tabs-custom">
            <ul class="nav nav-tabs">
                <li class="active"><a href="#start-auth" data-toggle="tab" aria-expanded="true">发起权限</a></li>
                <li><a href="#edit-auth" data-toggle="tab" aria-expanded="true">表单编辑权限</a></li>
            </ul>
            <div class="tab-content">
                <div class="tab-pane active" id="start-auth">
                    <table class="table table-responsive fieldlist table-bordered" data-name="start" data-template="start-rule-tpl" data-tag="tr">
                        <tr><th>行为</th><th>域</th><th>人员/分组(留空表示全部)</th><th>流程操作</th></tr>
                        <tr><td colspan="5"><a href="javascript:;" class="btn btn-sm btn-success btn-append btn-new-start-rule"><i class="fa fa-plus"></i> 添加规则</a></td></tr>
                        <textarea name="start" class="form-control hidden" cols="30" rows="5"></textarea>
                    </table>
                    <script type="text/html" id="start-rule-tpl">
                        <tr class="form-inline">
                            <td><select name="<%=name%>[<%=index%>][behavior]"  class="form-control selectpicker rule-behavior" value="<%=row.behavior%>"></select></td>
                            <td><select name="<%=name%>[<%=index%>][scope]" class="form-control selectpicker rule-scope" value="<%=row.scope%>"></select></td>
                            <td><input data-source="{:url('getSelectpageWorkers')}" data-field="name" data-primary-key="id" data-multiple="true" class="form-control selectpage rule-worker" name="<%=name%>[<%=index%>][worker]" value="<%=row.worker%>" type="text"></td>
                            <td><select name="<%=name%>[<%=index%>][control]" class="form-control selectpicker rule-control" value="<%=row.control%>"></select></td>
                            <td><span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span></td>
                        </tr>
                    </script>
                </div>
                <div class="tab-pane" id="edit-auth">
                    <table class="table table-responsive fieldlist table-bordered" data-name="edit" data-template="edit-rule-tpl" data-tag="tr">
                        <tr><th>行为</th><th>步骤(留空表示全部)</th><th>审批人/分组操作</th><th>字段(留空表示全部)</th><th>删除</th></tr>
                        <tr><td colspan="5"><a href="javascript:;" class="btn btn-sm btn-success btn-append btn-new-edit-rule"><i class="fa fa-plus"></i> 添加规则</a></td></tr>
                        <textarea name="edit" class="form-control hidden" cols="30" rows="5"></textarea>
                    </table>
                    <script type="text/html" id="edit-rule-tpl">
                        <tr class="form-inline">
                            <td><select name="<%=name%>[<%=index%>][behavior]"  class="form-control selectpicker rule-behavior" value="<%=row.behavior%>"></select></td>
                            <td><select name="<%=name%>[<%=index%>][steps][]" multiple class="form-control selectpicker rule-steps" value="<%=row.steps%>"></select></td>
                            <td><select name="<%=name%>[<%=index%>][control]" class="form-control selectpicker rule-control" value="<%=row.control%>"></select></td>
                            <td><select name="<%=name%>[<%=index%>][fields][]" multiple class="form-control selectpicker rule-fields" value="<%=row.fields%>"></select></td>
                            <td><span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span></td>
                        </tr>
                    </script>
                </div>
            </div>
        </div>
        <div class="form-group layer-footer">
            <label class="control-label col-xs-12 col-sm-4"></label>
            <div class="col-xs-12 col-sm-8">
                <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
                <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
            </div>
        </div>
    </form>
</div>
